package cn.wolfcode.web.controller;

import cn.wolfcode.qo.JsonResult;
import cn.wolfcode.qo.QueryObject;
import cn.wolfcode.service.IPermissionService;
import cn.wolfcode.util.Request;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/permission")
public class PermissionController {



        @Autowired
        private IPermissionService permissionService;


        @RequestMapping("/list")
        public String list(@ModelAttribute("qo") QueryObject qo, Model model){
            model.addAttribute("pageResult",permissionService.selectList(qo));
            return "permission/list";
        }

        @Request(name = "权限加载",expression = "permission.reload")
        @RequestMapping("/reload")
        @ResponseBody
        public String reload(){
            permissionService.reload();

            return "/permission/list";
        }


}
